package com.zzyl.mapper;

import com.zzyl.entity.UserRole;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserRoleMapper {

    @Delete("delete from sys_user_role where user_id = #{userId}")
    boolean deleteUserRoleByUserId(Long id);
    //批量插入
    int batchInsert(@Param("list") List<UserRole> list);
    // 删除用户与角色关联
    @Delete("delete from sys_user_role where user_id = #{userId}")
    void deleteRole(String userId);
    //根据角色id查询角色使用数量
    @Select("select count(1) from sys_user_role where role_id = #{roleId}")
    int count(Long roleId);
}
